package com.cyz.web.app.leetcode.removeElement;

public class Client {


    public static void main(String[] args) {
        Client c = new Client();
        int[] nums = new int[]{0,1,2,2,3,0,4,2};
        int val = 2;
        int r = c.removeElement(nums, val);
        System.out.println(r);
    }


    public int removeElement(int[] nums, int val){
        int size = 0;
        for (int i=0;i<nums.length;i++){
            if (nums[i]!= val){
                nums[size] = nums[i];
                size ++;
            }
        }
        return size;
    }


}
